package com.example.demo.pojo.entity;

import com.example.demo.controller.ValidateGroup;
import com.example.demo.enumeration.ItemCategory;
import com.example.demo.enumeration.ItemStatus;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Getter
@Setter
@ToString
public class Item {
    @NotNull(groups = ValidateGroup.Crud.Read.class, message = "商品id不能为空")
    private Long id;

    private String name;

    @NotNull(groups = ValidateGroup.Crud.Update.class, message = "商品价格不能为空")
    @Digits(integer = 5, fraction = 2, message = "商品价格整数部分限制为5位，小数部分限制为2位")
    private BigDecimal price;

    private String description;

    private ItemCategory category;

    private Long userId;

    private ItemStatus status;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    public Item() {
    }

    public Item(Long id, String name, BigDecimal price, String description, ItemCategory category, Long userId, ItemStatus status, LocalDateTime createTime, LocalDateTime updateTime) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.description = description;
        this.category = category;
        this.userId = userId;
        this.status = status;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }
}
